package yuan.test;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import javax.sql.DataSource;
import java.beans.PropertyVetoException;
import java.sql.Connection;

public class C3p0Test1 {
    public static void main(String[] args) throws Exception {
        //c3p0连接池
        //创建数据库连接池对象
        ComboPooledDataSource ds=new ComboPooledDataSource();
        //设置数据库连接的四大基本特征
        ds.setDriverClass("com.mysql.jdbc.Driver");
        ds.setJdbcUrl("jdbc:mysql://192.168.96.131:3306/db8");
        ds.setUser("root");
        ds.setPassword("root");
        //获取连接对象
        Connection con = ds.getConnection();
        System.out.println(con);
        //执行操作
        //释放资源
        ds.close();
        con.close();
    }
}
